<style>
	.container{
		display:flex;
		height:100rpx;  
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding-top:-20rpx;
	}
	.iconsize{
	 display:flex;
	 height: 800rpx;                   
	 justify-content: center;        
	 align-items:center;               
	}
	.iconsize image { 
	  width:400rpx;
	  height:400rpx;
	  border-radius: 200px;
	}
	.radio{
		display:flex;
		height: 100rpx;                   
		justify-content: center;
		align-items:center;  
	}
	.text{
		text-align:center;
		display:block;
		margin:auto;
		width: 750rpx;
		padding-top: 10rpx;
	}

</style>
<template>
	<view style="background-color: #FFFFFF;">
		<view class=""style="background-color: #ffffff;">
			<view class="iconsize">
				<image src="/static/img/imgTest.png"/>
			</view>
			<view class="text">
				<checkbox-group class="uni-title uni-common-mt" @change="radioChange">
					<label>
						<checkbox color="#FFCC33" style="transform:scale(0.7);text-align: center;" value="success" ></checkbox>	
						<text>我同意发布条款，保证内容真实健康</text>
					</label>
				</checkbox-group>
			</view>
			<view class="container">
				<button :disabled="checkbox" @getuserinfo="login"  bind open-type="getUserInfo" withCredentials="true">授权登录</button>
			</view>	
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return{
			checkbox:'false',
			user:{
				nickname:'',
				iconUrl:'',
				sex:''
			}
		}
	},
	onLoad: function(options) {
	
	    var that = this;
	    //查看是否授权
	    wx.getSetting({
	      success: function(res) {
	
	        if (res.authSetting['scope.userInfo']) {
				//console.log("用户有授权");
				uni.switchTab({
					url:'../home/home'
				})
	
	        }else{
				//console.log("用户没有授权");
			}
	      }
	    });
	  },
	methods:{
		radioChange:function(e){
			this.checkbox = !this.checkbox;
		}, 
		login(){
			var that=this;
			uni.login({
				success: (res) => {
					getApp().globalData.text = res.code;
					console.info(res.code);
					uni.getUserInfo({
						success() {
							console.info("getuserinfo_success");
							uni.reLaunch({
								url:"../home/home"
							})
						}
					})
					
				}
			})
		}
	}
}
</script>
